# coding:utf-8
from django.db import models


class Article(models.Model):
    title = models.CharField(u'标题', max_length=256)
    content = models.TextField(u'内容')
    ub_date = models.DateTimeField(u'发表时间', auto_now_add=True, editable=True)
    update_time = models.DateTimeField(u'更新时间', auto_now=True, null=True)

    def __str__(self):
        return self.title


class BookInfo(models.Model):
    btitle = models.CharField(u'标题', max_length=16)
    bpub_date = models.DateField(u'时间', editable=True);

    def __str__(self):
        return self.btitle


class HeroInfo(models.Model):
    hname = models.CharField(u'姓名', max_length=16)
    hgender = models.BooleanField(u'性别')
    hcontent = models.TextField(u'内容')
    hbook = models.ForeignKey(BookInfo)

    def __str__(self):
        return self.hname


class Test(models.Model):
    num = models.AutoField(primary_key=True)
    data = models.CharField(max_length=45, blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'test'
